package com.example.kaoshi;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * Created by Quincy on 2018/10/10.
 */
public class TiaoYue {

    static int[] b;
    static ArrayList<Integer> list = new ArrayList<>();
    public static void main(String[] args){

        int stepcount = 0;
        Scanner scanner = new Scanner(System.in);

        String s = scanner.nextLine();
        String[] str = s.split(" ");
        int[] a = new int[str.length];
        for (int i = 0; i < str.length; i++)
            a[i] = Integer.parseInt(str[i]);


        stepcount = jump(a);
        System.out.println(stepcount);

//        int[] steps = leastSteps2Last(a);
//        for(int i : steps){
//            System.out.println(i);
//        }


    }


    public static int[] leastSteps2Last(int[] input){
        if(input.length == 1){
            return input;
        }


        Map<Integer, int[]> subSteps = new HashMap<>();
        for(int i = 1; i <= input[0]; i++){

            if(1 + i < input.length){
                int[] nextSubList = new int[input.length - i];

                System.arraycopy(input, i, nextSubList, 0, nextSubList.length);

                int[] nextSteps = leastSteps2Last(nextSubList);


                int[] currSteps = new int[nextSteps.length + 1];
                currSteps[0] = input[0];
                System.arraycopy(nextSteps, 0, currSteps, 1, nextSteps.length);
                subSteps.put(i, currSteps);

            }else if(1 + i == input.length){
                return new int[]{input[0],input[input.length-1]};
            }

            else if(1 + i > input.length){
                break;
            }
        }

        int[] leastSteps = null;
        int stepNum = Integer.MAX_VALUE;
        for(Map.Entry<Integer, int[]> entry : subSteps.entrySet()){
            if(entry.getValue().length < stepNum){
                leastSteps = entry.getValue();
                stepNum = entry.getValue().length;
                System.out.println(stepNum);
            }
        }
        return leastSteps;
    }


    private static int jumpStep(int[] a) {
        if (a.length == 1) return 0;
        return getLen(a,0);
    }

    private static int getLen(int[] a, int i) {
        if (i > a.length - 1 )return 0;
        int val = a[i];
        int min = a.length;
        for (int j = i + 1; j < i + val; j++){
            min = Math.min(getLen(a, j),min);
            list.add(a[i]);
//            System.out.println(a[i]);
        }
        return min+1;
    }

    public static int jump(int[] nums) {
        if (nums.length <= 1)return 0;
        int i = 0, n = nums.length, lc = 0, ln = 0, step = 1;
        // lc means the longest distance can achieve by current jump
        // ln means the longest distance can achieve by next jump
        lc = nums[0];
        ln = nums[0]; // Initialize to index 0, the start point.
        for (i = 1; i < n; ++i) {
            if (i > lc){ // current jump cannot get index i -->>> must jump one more time.
                lc = ln;
                step++;
                System.out.println(nums[i]);
            }
            if (i + nums[i] > ln)ln = i + nums[i]; // maintain the furthest distance of next jump can get
            if (lc >= n - 1) return step;// current jump can achieve the last index
        }
        return step;
    }

}
